home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / emulator / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / samples / Hector1600 / UnsignedDiv.lis < prev    next >
File List  |  1995-07-26  |  5KB  |  98 lines

  1.      0000                      1 ;
  2.      0000                      2 ; ECE463 Unsigned Division
  3.      0000                      3 ;
  4.      0000                      4 ; Coded by: Bradford W. Mott
  5.      0000                      5 ;           September 8,1993
  6.      0000                      6 ;
  7.      0000                      7 
  8.      0000                      8           .org 0000
  9.      0000                      9 
  10.      0000  d8fe 0200          10           move #512,sp
  11.      0002  d8f0 0000          11           move #0,r0            ; Init Loop Variable
  12.      0004                     12  
  13.      0004  a8f0 0003          13 loop:     cmp  #num_els,r0      ; Check to see if we're finished
  14.      0006  c80d 0011          14           bra  finished,.eq
  15.      0008                     15 
  16.      0008  d001               16           move r0,r1
  17.      0009  0011               17           add  r1,r1
  18.      000a                     18 
  19.      000a  dc17 0100          19           move [r1,data1],r7    ; Get the dividend
  20.      000c  dc18 0101          20           move [r1,data1+1],r8
  21.      000e  dc09 0106          21           move [r0,data2],r9    ; Get the divisor
  22.      0010  c90b 0008          22           jsr  divide           ; divide the two numbers
  23.      0012                     23 
  24.      0012  d3a1 0109          24           move r10,[r1,result]
  25.      0014  d3b1 010a          25           move r11,[r1,result+1]
  26.      0016                     26 
  27.      0016  8200               27           inc  r0
  28.      0017  c80b ffeb          28           bra  loop
  29.      0019                     29 
  30.      0019  7000               30 finished: stop
  31.      001a                     31 
  32.      001a                     32 
  33.      001a  c3aa               33 divide:   clr  r10              ; quot
  34.      001b                     34 
  35.      001b  d8fd 0010          35           move #16,r13          ; Init the counter
  36.      001d                     36 
  37.      001d  f100               37 dloop:    clc
  38.      001e  91aa               38           rol  r10              ; quot := Bshl(quot,0,C)
  39.      001f                     39 
  40.      001f  f100               40           clc
  41.      0020  9188               41           rol  r8               ; loDvnd := Bshl(loDvnd,0,C)
  42.      0021  9177               42           rol  r7               ; hiDvnd := Bshl(hiDvnd,C,C)
  43.      0022                     43 
  44.      0022  d8fc 0000          44           move #0,r12
  45.      0024  c807 0002          45           bra  no_flag,.cc
  46.      0026  d8fc 0001          46           move #1,r12       
  47.      0028                     47 
  48.      0028  f000               48 no_flag:  sec
  49.      0029  8099               49           not  r9
  50.      002a  1097               50           addc r9,r7            ; hiDvnd := Badd(hiDvnd,Bcom(dvsr),1,C)
  51.      002b                     51 
  52.      002b  c807 0002          52           bra  no_flag2,.cc
  53.      002d  d8fc 0001          53           move #1,r12
  54.      002f                     54 
  55.      002f  8099               55 no_flag2: not  r9
  56.      0030  a8fc 0001          56           cmp #1,r12
  57.      0032  c80d 0004          57           bra  set_bit,.eq
  58.      0034                     58 
  59.      0034  f100               59           clc
  60.      0035  1097               60           addc r9,r7            ; hiDvnd := Badd(hiDvnd,dvsr,0,C)
  61.      0036  c80b 0002          61           bra  next
  62.      0038                     62 
  63.      0038  58fa 0001          63 set_bit:  or #1,r10
  64.      003a                     64 
  65.      003a  83dd               65 next:     dec  r13
  66.      003b  c805 ffe0          66           bra  dloop,.ne
  67.      003d                     67 
  68.      003d  d07b               68           move r7,r11
  69.      003e                     69  
  70.      003e  d8ef               70           rts                   ; That's All
  71.      003f                     71 
  72.      003f                     72 
  73.      0100                     73           .org  256
  74.      0100                     74 
  75.      0100                     75 num_els:  .equ  3
  76.      0100  0000 0064 0000     76 data1:    .word 0x0000,0x0064,0x0000,0x00FF,0x00FF,0xFFFF
  77.      0103  00ff 00ff ffff
  78.      0106  000a 000f 0f00     77 data2:    .word        0x000A,       0x000F,       0x0F00
  79.      0109                      78 result:   .rmw  num_els+num_els
  80.      010f                     79 
  81.  
  82.     dloop         001d       37#   66 
  83.     .           = 010f    
  84.     divide        001a       22    33#
  85.     result        0109       24    25    78#
  86.     no_flag       0028       45    48#
  87.     set_bit       0038       57    63#
  88.     num_els       0003       13    75#   78    78 
  89.     no_flag2      002f       52    55#
  90.     finished      0019       14    30#
  91.     loop          0004       13#   28 
  92.     next          003a       61    65#
  93.     data1         0100       19    20    76#
  94.     data2         0106       21    77#
  95.  
  96.     13 Symbols
  97.     28 References
  98.